<script type="text/javascript">
	function doSearchCmsFriendlyLink(value) {
		
	}
	
	//表格查询  
	function reloadCmsFriendlyLink() {
		var params = cmsFriendlyLink_list.datagrid('options').queryParams; //先取得 datagrid 的查询参数  
		printLog(params);
		cmsFriendlyLink_list.datagrid('reload'); //设置好查询参数 reload 一下就可以了  
		cmsFriendlyLink_list.datagrid('unselectAll');
		cmsFriendlyLink_list.datagrid('uncheckAll');
	}


	function addCmsFriendlyLink() {
		createFromWindow("新增信息", "cmsFriendlyLink.do?editCmsFriendlyLink", "cmsFriendlyLink.do?saveCmsFriendlyLink",
				function(data) {
					reloadCmsFriendlyLink();
				});
	}
	
	function deleteCmsFriendlyLink() {
		var rows = cmsFriendlyLink_list.datagrid('getChecked');
	    if (rows&&rows.length>0){
	        $.messager.confirm('询问','你确认要删除吗?',function(r){
	            if (r){
	            	var ids = "";
	            	for(var i=0; i<rows.length; i++){
	            		ids += rows[i].id+",";
	            	}
	                $.post('cmsFriendlyLink.do?deleteCmsFriendlyLinkItems',{ids:ids},function(result){
	                    if (result.success){
	                    	reloadCmsFriendlyLink();    
	                    }
	                    showMsg(result.msg);
	                },'json');
	            }
	        });
	    }else {
	    	showMsg("请选择操作记录.");
	    }
	}

	function editCmsFriendlyLink() {
		var rows = cmsFriendlyLink_list.datagrid('getChecked');
		printLog(rows);
		if (rows&&rows.length>0) {
			if(rows.length>1) {
				showMsg('请选择一条操作记录.');
				return;
			}
			createFromWindow("编辑信息", "cmsFriendlyLink.do?editCmsFriendlyLink&cmsFriendlyLinkId=" + rows[0].id,
					"cmsFriendlyLink.do?saveCmsFriendlyLink", function(data) {
						reloadCmsFriendlyLink();
					},true);
		} else {
			showMsg('请选择操作记录.');
		}

	}
	
	
	function clearCmsFriendlyLinkSearch() {
		setGridSearchParams('cmsFriendlyLink_list','cmsFriendlyLinkSearchForm',true,reloadCmsFriendlyLink);
	}
	
	//根据条件查询
	function cmsFriendlyLinkSearch() {
		setGridSearchParams('cmsFriendlyLink_list','cmsFriendlyLinkSearchForm',false,reloadCmsFriendlyLink);
	}
	
	function onDblClickCmsFriendlyLinkRow(rowIndex, rowData) {
		createFromWindow("编辑信息", "cmsFriendlyLink.do?editCmsFriendlyLink&cmsFriendlyLinkId=" + rowData.id,
					"cmsFriendlyLink.do?saveCmsFriendlyLink", function(data) {
						reloadCmsFriendlyLink();
					},true);
	}
</script>


<div class="easyui-layout" data-options="fit:true">
	<div data-options="region:'center',border:false">
		<@eu.datagrid id="cmsFriendlyLink_list" toolbar="#cmsFriendlyLinklist_search" idField="id"  url="cmsFriendlyLink.do?loadList" rownumbers="true" onDblClickRow="onDblClickCmsFriendlyLinkRow(rowIndex, rowData)"
			 item="com.xdtech.cms.vo.CmsFriendlyLinkItem"/>
		
		<div id="cmsFriendlyLinklist_search">
			<div style="margin-bottom:5px;padding-left:5px;margin-top: 5px;">
				<form id="cmsFriendlyLinkSearchForm">
					<!-- 防止form表单里只有一个text元素时候，按enter键自动提交问题 -->
					<input style="display:none" />
					<table>
						<tr>
							<td>链接组名：</td>
							<td><input class="easyui-validatebox textbox" name="groupName" style="width: 150px"/></td>
							<td>链接名称：</td>
							<td><input class="easyui-validatebox textbox" name="linkName" style="width: 150px"/></td>
							<td>链接地址：</td>
							<td><input class="easyui-validatebox textbox" name="linkUrl" style="width: 150px"/></td>
							<td>
								<@eu.linkbutton showName="查询" iconCls="icon-search" onclick="cmsFriendlyLinkSearch()"/>
	 					 		<@eu.linkbutton showName="清空" iconCls="icon-clear" onclick="clearCmsFriendlyLinkSearch()"/>
 					 		</td>
						</tr>
					</table>
				</form>
				
			</div>
			<div id="cmsFriendlyLink_toolbar" style="height: auto">
				<@eu.linkbutton showName="新增" shiro="cms:cmsFriendlyLink:add" iconCls="icon-add" onclick="addCmsFriendlyLink()"/>
				<@eu.linkbutton showName="删除" shiro="cms:cmsFriendlyLink:delete" iconCls="icon-remove" onclick="deleteCmsFriendlyLink()"/>
				<@eu.linkbutton showName="编辑" shiro="cms:cmsFriendlyLink:edit" iconCls="icon-edit" onclick="editCmsFriendlyLink()"/>
				<@eu.linkbutton showName="刷新" shiro="cms:cmsFriendlyLink:refresh" iconCls="icon-reload" onclick="reloadCmsFriendlyLink()"/>
			</div>
		</div>
	</div>
</div>